package com.jiazhong.example.project.bookstore.backend.controller;

import com.jiazhong.example.project.bookstore.backend.service.CategoryService;
import com.jiazhong.example.project.bookstore.commons.util.JsonResult;
import jakarta.annotation.Resource;
import org.springframework.web.bind.annotation.*;

@RestController
@RequestMapping("/category")
public class CategoryController {
    @Resource
    private CategoryService categoryService;

    @GetMapping
    public JsonResult find() {
        return categoryService.find();
    }

    @DeleteMapping("/1/{id}")
    public JsonResult remove1(@PathVariable("id") String id) {
        return categoryService.removeByCategoryId1(id);
    }

    @DeleteMapping("/2/{id}")
    public JsonResult remove2(@PathVariable("id") String id) {
        return categoryService.removeByCategoryId2(id);
    }
}
